import { TWedding } from "../../../Message/Db/Tables/TWedding";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { Vector } from "../../../__AS3__/vec/Vector";
type int = number;
//class MarryWeddingConfig
    
    export  class MarryWeddingConfig
    {
        constructor()
        {
            
            this.vcTWedding = new Vector.<TWedding>();
            if (MarryWeddingConfig._instance != null) 
            {
                throw new Error(" PetConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TWedding();
                loc1.type = loc2.type;
                loc1.name = StringHelper.getString(loc2.name);
                loc1.unit = loc2.unit;
                loc1.price = loc2.price;
                loc1.priceSameSex = loc2.priceSameSex;
                loc1.guest = loc2.guest;
                loc1.desc = StringHelper.getString(loc2.desc);
                loc1.boss = loc2.boss;
                loc1.bossSameSexMan = loc2.bossSameSexMan;
                loc1.bossSameSexWomen = loc2.bossSameSexWomen;
                loc1.candy = loc2.candy;
                loc1.candyNum = loc2.candyNum;
                loc1.gift = loc2.gift;
                loc1.shopDrop = loc2.shopDrop;
                loc1.guestMax = loc2.guestMax;
                loc1.heartLock = loc2.heartLock;
                loc1.mailItem = loc2.mailItem;
                loc1.lowPrice = loc2.lowPrice;
                loc1.scene = loc2.scene;
                this.vcTWedding.push(loc1);
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_wedding.json");
            this.write(loc1);
            return;
        }

        public getAllWedding(): Vector.<TWedding>
        {
            return this.vcTWedding;
        }

        public getWeddingByType(arg1: int): TWedding
        {
            var loc1=null;
            var loc2=0;
            var loc3=this.vcTWedding;
            for(loc1 of loc3) 
            {
                if (loc1.type != arg1) 
                {
                    continue;
                }
                return loc1;
            }
            return null;
        }

        public getWeddingBySexType(arg1: int): Vector.<TWedding>
        {
            var loc2=null;
            var loc1=new Vector.<TWedding>();
            var loc3=0;
            var loc4=this.vcTWedding;
            for(loc2 of loc4) 
            {
                if (arg1 < 0) 
                {
                    loc1.push(loc2);
                    continue;
                }
                if (loc2.priceSameSex == 0) 
                {
                    continue;
                }
                loc1.push(loc2);
            }
            return loc1;
        }

        public static get instance(): MarryWeddingConfig
        {
            if (MarryWeddingConfig._instance == null) 
            {
                MarryWeddingConfig._instance = new MarryWeddingConfig();
            }
            return MarryWeddingConfig._instance;
        }

        /* internal */ /* var */vcTWedding: Vector.<TWedding>;

        /* internal */ static /* var */_instance: MarryWeddingConfig;
    }
